<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <div id="app">
      <com-a @tofa='getData'></com-a>
  </div>

  <template id="tmp">
      <div>
          <button @click='send'>click</button>
      </div>
  </template>
  <script src="./vue.js"></script>
  <script>
      const comA = {
          template: '#tmp',
          data(){
              return {
                msg:"comA data"
              }
          },
          methods: {
              send() {
                  this.$emit("tofa",this.msg)
              }
          }
      }

    var vm = new Vue({
      el:'#app',
      data:{

      },
      methods:{
          getData(res) {
            console.log(res);
          }
      },
      components: {
          comA
      }
     });
  </script>
</body>
</html>
